/*******************************************************************************
*  file    : testdataplugin.cpp
*  created : 07.07.2012
*  author  : Slyshyk Oleksiy (alex312@meta.ua)
*******************************************************************************/

#include "testdataplugin.hpp"
#include <QVector>

#ifndef M_PI
#define M_PI (3.1415926535897932384626433832795)
#endif

QString TestDataPlugin::name() const
{
    return QString("test_390");
}

double TestDataPlugin::sampleRate() const
{
    return 4000.0;
}

QVector<std::complex<double> > TestDataPlugin::getData()
{
    QVector<std::complex<double> > res;
    double Fs = sampleRate();
    int Nd = Fs * 3;
    //генерация данных
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*380.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*195.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg+M_PI/2),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*780.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            res.push_back(0);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*391.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*392.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*389.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg+M_PI/3),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*390.5)*(i/Fs);
            d = std::complex<double>(std::sin(arg),0);
            res.push_back(d);
        }
    for(int i = 0; i < Nd; ++i)
        {
            std::complex<double> d;
            double arg = (2.0*M_PI*390.0)*(i/Fs);
            d = std::complex<double>(std::sin(arg+M_PI/2),0);
            res.push_back(d);
        }
    return res;
}
